home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Programmer's Power Pack
/
Delphi Volume 1.iso
/
e_to_l
/
isamexpt
/
isamexpt.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-09-15
|
34KB
|
1,045 lines
{C 1996 Stellberg GmbH}
{ HISTORY OF CHANGES: see CHANGES.PAS }
unit Isamexpt;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, Menus, ToolIntf,
ExptIntf;
type
TIsamMainForm = class(TForm)
StatusLine: TPanel;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Sample: TPaintBox;
Notebook1: TNotebook;
GroupBox1: TGroupBox;
CancelBttn: TBitBtn;
Rueckbttn: TBitBtn;
VorBttn: TBitBtn;
GroupBox2: TGroupBox;
EdiHauptCheck: TCheckBox;
GroupBox4: TGroupBox;
BrwHauptCheck: TCheckBox;
FileopenBttn: TSpeedButton;
GroupBox5: TGroupBox;
Label7: TLabel;
Label4: TLabel;
Edit1: TEdit;
Label3: TLabel;
SpeedButton1: TSpeedButton;
Label6: TLabel;
Edit3: TEdit;
SpeedButton3: TSpeedButton;
BrwCheck: TCheckBox;
EdiCheck: TCheckBox;
Label9: TLabel;
DirInput: TEdit;
SpeedButton4: TSpeedButton;
Label10: TLabel;
Label11: TLabel;
IniDatNamInput: TEdit;
IniBrwNamInput: TEdit;
GroupBox6: TGroupBox;
LabelNebenRadio: TRadioButton;
LabelueberRadio: TRadioButton;
GroupBox7: TGroupBox;
LenFestRadio: TRadioButton;
LenVarRadio: TRadioButton;
EdiFontLabel: TLabel;
EdiInputFontLabel: TLabel;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
FontDialog1: TFontDialog;
SpeedButton7: TSpeedButton;
LboxFontLabel: TLabel;
Memo1: TMemo;
GroupBox9: TGroupBox;
Memo2: TMemo;
GroupBox10: TGroupBox;
Memo3: TMemo;
Label2: TLabel;
TableNameInput: TEdit;
HelpBttn: TBitBtn;
SprachBttn: TBitBtn;
DateiBttn: TSpeedButton;
OpenDialog2: TOpenDialog;
EditorFormNameInput: TEdit;
BrwFormNameInput: TEdit;
Label1: TLabel;
DBaseExpCheck: TCheckBox;
DBaseImpCheck: TCheckBox;
DBStruEdit: TEdit;
Label5: TLabel;
DBStruBttn: TSpeedButton;
TblCreatCheck: TCheckBox;
SaveTypBttn: TBitBtn;
SaveDialog2: TSaveDialog;
BrwSetupCheck: TCheckBox;
AliasEdit: TComboBox;
Label8: TLabel;
procedure FormCreate(Sender: TObject);
procedure ShowHint(Sender: TObject);
procedure FileopenBttnClick(Sender: TObject);
procedure EndeBttnClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure SamplePaint(Sender: TObject);
procedure EdiCheckClick(Sender: TObject);
procedure CancelBttnClick(Sender: TObject);
procedure RueckbttnClick(Sender: TObject);
procedure VorBttnClick(Sender: TObject);
procedure EdiHauptCheckClick(Sender: TObject);
procedure BrwHauptCheckClick(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure Memo1Exit(Sender: TObject);
procedure HelpBttnClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormShow(Sender: TObject);
procedure SprachBttnClick(Sender: TObject);
procedure DateiBttnClick(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
procedure Edit3Exit(Sender: TObject);
procedure EditorFormNameInputExit(Sender: TObject);
procedure BrwFormNameInputExit(Sender: TObject);
procedure TableNameInputExit(Sender: TObject);
procedure DirInputExit(Sender: TObject);
procedure DBaseExpCheckClick(Sender: TObject);
procedure DBaseImpCheckClick(Sender: TObject);
procedure DBStruEditExit(Sender: TObject);
procedure DBStruBttnClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure SaveTypBttnClick(Sender: TObject);
procedure AliasEditClick(Sender: TObject);
Private
DrawBitmap: TBitmap;
RecList,KeyList,IIDList: TStringList;
Sprache: Integer;
TypDateiName: String;
Procedure CheckButtons;
function DoFormCreation(const FormIdent: string): TForm;
function CreateEditorSource(const UnitIdent, FormIdent: string): TMemoryStream;
function CreateEditorForm(const FormIdent: string): TMemoryStream;
function DoBrwFormCreation(const FormIdent: string): TForm;
function CreateBrowserForm(const FormIdent: string): TMemoryStream;
function CreateBrowserSource(const UnitIdent, FormIdent,
EdiUnitIdent, EdiFormIdent: string): TMemoryStream;
function CreateStru(Const FormIdent: String): TMemoryStream;
Procedure Update_Listen(i: Integer);
Procedure Setze_Sprache(S: Integer);
end;
TIsamDialogExpert = class(TIExpert)
public { Methods required by Delphi to define the expert }
function GetName: string; override;
function GetComment: string; override;
function GetGlyph: HBITMAP; override;
function GetStyle: TExpertStyle; override;
function GetState: TExpertState; override;
function GetIDString: string; override;
procedure Execute; override;
public
private
end;
implementation
Uses Db, Proxies, IStreams, DirAusw, UToolDll,
WntIsam1, WntIsam2, WntIsam3, WntIsam4,
VirtIntf, Inifiles;
{$R *.DFM}
{$R EXPTISAM.RES}
procedure HandleException;
begin
ToolServices.RaiseException(ReleaseException);
end;
procedure WntvIsamDialogExpert(ToolServices: TIToolServices);
var
D: TIsamMainForm;
ISourceStream, IFormStream, IStruStream: TIMemoryStream;
UnitIdent, FormIdent, BrwIdent: string[79];
BrwUnitIdent, BrwFileName, StruIdent: String;
UZahl,Code: Integer;
StruFileName,UStr, Dir: String;
FileName: TFileName;
IniFile : TIniFile;
begin
if ToolServices = nil then Exit;
if ToolServices.GetNewModuleName(UnitIdent, FileName) then
begin
D := TIsamMainForm.Create(Application);
try
D.Edit1.Text:= '';
D.Edit3.Text:= '';
Inifile:= TIniFile.Create('ISAMEXPT.INI');
Dir:= IniFile.ReadString('EXPERT','PATH','');
D.Sprache:= IniFile.ReadInteger('EXPERT','LANGUAGE',0);
D.TblCreatCheck.Checked:= (IniFile.ReadInteger('EXPERT','CREATEBUTTON',0) = 1);
D.BrwSetupCheck.Checked:= (IniFile.ReadInteger('EXPERT','SETUPBUTTON',0) = 1);
D.DBaseExpCheck.Checked:= (IniFile.ReadInteger('EXPERT','DBASEEXPORT',0) = 1);
D.DBaseImpCheck.Checked:= (IniFile.ReadInteger('EXPERT','DBASEIMPORT',0) = 1);
IniFile.Free;
D.DirInput.Text:= Dir;
if D.ShowModal = mrOK then begin
Dir:= D.DirInput.Text;
Inifile:= TIniFile.Create('ISAMEXPT.INI');
IniFile.WriteString('EXPERT','PATH',Dir);
IniFile.WriteInteger('EXPERT','LANGUAGE',D.Sprache);
if D.TblCreatCheck.Checked then
IniFile.WriteInteger('EXPERT','CREATEBUTTON',1)
else
IniFile.WriteInteger('EXPERT','CREATEBUTTON',0);
if D.BrwSetupCheck.Checked then
IniFile.WriteInteger('EXPERT','SETUPBUTTON',1)
else
IniFile.WriteInteger('EXPERT','SETUPBUTTON',0);
if D.DBaseExpCheck.Checked then
IniFile.WriteInteger('EXPERT','DBASEEXPORT',1)
else
IniFile.WriteInteger('EXPERT','DBASEEXPORT',0);
if D.DBaseImpCheck.Checked then
IniFile.WriteInteger('EXPERT','DBASEIMPORT',1)
else
IniFile.WriteInteger('EXPERT','DBASEIMPORT',0);
IniFile.Free;
UnitIdent:= D.Edit1.Text;
if Pos('.',UnitIdent) > 0 then UnitIdent:= Copy(UnitIdent,1,Pos('.',UnitIdent)-1);
FormIdent:= D.EditorFormNameInput.Text;
if Pos('.',FormIdent) > 0 then FormIdent:= Copy(FormIdent,1,Pos('.',FormIdent)-1);
BrwUnitIdent:= D.Edit3.Text;
BrwIdent := D.BrwFormNameInput.Text;
FileName:= Dir + UnitIdent + '.PAS';
BrwFileName:= Dir + BrwUnitIdent + '.PAS';
if D.BrwCheck.Checked then begin
IFormStream := TIMemoryStream.Create(D.CreateBrowserF